﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BDS3M.Admin.Controls
{
    public partial class ListSanGiaoDich : System.Web.UI.UserControl
    {
        public int count;
        public string name;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    count = 1;
                    rpt_contact.DataSource = DAL.DCollector.DBCollector.Instance.StoredSelectAllTable("tbl_SanGiaoDich");
                    rpt_contact.DataBind();
                }
            }
            catch (Exception)
            {
                Response.Redirect("/Admin/error.htm");
            }
        }

        protected void rpt_contact_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                int id = Convert.ToInt32(e.CommandArgument.ToString());
                DAL.DCollector.DBCollector.Instance.StoredProcedureDeleteByRows("tbl_TienIch", "SanGiaoDich_ID", id.ToString());
                DAL.DCollector.DBCollector.Instance.StoredProcedureDeleteByRows("tbl_SanGiaoDich", "SanGiaoDich_ID", id.ToString());
                Response.Redirect("/Admin/Index.aspx?panel=1&sub=7");
            }
        }
    }
}